<template>
  <view>{{name}}</view>
  <view>num: {{num}}</view>
  <button @click="$emit('emitValue', '666')">test1</button>
</template>

<script setup>
  import {
    defineProps,
    defineEmits,
    ref
  } from "vue";
  
  let num = ref(0)
  const numAdd = () => {
    console.log('父按钮操作子组件')
    num.value++
  }

  defineProps({
    name: {
      type: String,
      default: 'wc'
    }
  })

  const emit = defineEmits(['emitValue'])
  
  defineExpose({
    num,
    numAdd
  })

  const emitValue = () => {
    emit('emitValue', '666')
  }
</script>

<style>
</style>
